package com.hwl.demo18;

import com.hwl.demo18.entity.Barbecuer;
import com.hwl.demo18.entity.Waiter;
import com.hwl.demo18.service.Command;
import com.hwl.demo18.service.impl.BakeChickenWingCommand;
import com.hwl.demo18.service.impl.BakeMuttonCommand;

/**
 * 命令模式
 *
 * @author sentry
 * @since 2023-03-26
 */
public class Main {

    public static void main(String[] args) {
        Barbecuer boy = new Barbecuer(); // 烤肉厨师
        Command bakeMuttonCommand = new BakeMuttonCommand(boy);
        Command bakeChickenWingCommand = new BakeChickenWingCommand(boy);
        Waiter girl = new Waiter(); // 服务员

        System.out.println("开门营业，顾客点菜");
        girl.setOrder(bakeMuttonCommand);
        girl.setOrder(bakeMuttonCommand);
        girl.setOrder(bakeMuttonCommand);
        girl.setOrder(bakeMuttonCommand);
        girl.setOrder(bakeMuttonCommand);

        girl.cancelOrder(bakeMuttonCommand);

        girl.setOrder(bakeChickenWingCommand);

        System.out.println("点菜完毕，通知厨房烧菜");
        girl.notifyCommand();
    }
}
